////
////  WLSelectorCell.swift
////  TestPay
////
////  Created by Yongpeng.Zhu on 2017/9/7.
////  Copyright © 2017年 Yongpeng.Zhu. All rights reserved.
////
//
//import UIKit
//
//
//public protocol WLCellButtonClickDelegate:class{
//    func didSelectRowAt(model:WLResourceItem,indexPath:IndexPath)
//}
//
///// WLSelectorCell 选中UI
/////
///// - normal: 选中只加外围特效
///// - large: 选中加外围特效并且自身变大
//public enum selectViewSelectedType {
//    case normal
//    case large
//}
//
//public class WLSelectorCell: UIView {
//    
//    @IBOutlet var content: UIView!
//    
//    /// 外部Img
//    @IBOutlet weak var outerView: UIImageView!
//    /// 内容ImgView
//    @IBOutlet weak var innerView: UIView!
//    /// 内容Img
//    @IBOutlet public weak var contentImageView: UIImageView!
//    
//    /// 外层容器 约束
//    @IBOutlet weak var backgroundConstraintW: NSLayoutConstraint!
//    @IBOutlet weak var backgroundConstraintH: NSLayoutConstraint!
//    
//    /// 内层容器 约束
//    @IBOutlet weak var innerConstraintW: NSLayoutConstraint!
//    @IBOutlet weak var innerConstraintH: NSLayoutConstraint!
//    
//    
//    public var model : WLResourceItem?
//    
//    ///是否选中
//    var selectedFlag: Bool = false
//    //当前是否可选中
//    var canSelect: Bool = true
//
//    public var indexPath:IndexPath!
//    
//    public weak var delegate : WLSelectViewDelegate?
//    
//    public weak var clickDelegate:WLCellButtonClickDelegate?
//    
//    public var selectedStyle: selectViewSelectedType? = .normal
//    
//    var selectedAction: (WLResourceItem)->Void = { _ in }
//
//    
//    override init(frame:CGRect) {
//        super.init(frame: frame)
//        commonInit()
//    }
//    
//    required public init?(coder aDecoder: NSCoder) {
//        super.init(coder: aDecoder)
//        commonInit()
//    }
//    
//    func commonInit() {
//        vom_bundle?.loadNibNamed("WLSelectorCell", owner: self, options: nil)
//        addSubview(content)
//        content.frame = self.bounds
//        innerView.layer.cornerRadius = innerView.bounds.size.width/2
//        innerView.layer.shadowColor = UIColor.black.cgColor
//        innerView.layer.shadowOffset = CGSize(width: 0, height: 3)
//        innerView.layer.shadowOpacity = 0.3
//        innerView.layer.shadowRadius = 4.0
//    }
//
//
//    @IBAction func tapAction(_ sender: Any) {
//        if let m = model,let i = indexPath{
//            clickDelegate?.didSelectRowAt(model: m, indexPath: i)
//        }
//    }
//    
//    ///
//    /// 选中效果
//    ///
//    func selected() {
//        
//        if !canSelect {
//            return
//        }
//        selectedFlag = true
//        
//        if self.selectedStyle == .large {
//            UIView.animate(withDuration: 0.4, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: [], animations: {
//                let newMultiplier:CGFloat = 1.0
//                self.backgroundConstraintW = self.backgroundConstraintW.setMultiplier(multiplier: newMultiplier)
//                self.backgroundConstraintH = self.backgroundConstraintH.setMultiplier(multiplier: newMultiplier)
//                
//                let newMultiplier1:CGFloat = 0.64
//                self.innerConstraintW = self.innerConstraintW.setMultiplier(multiplier: newMultiplier1)
//                self.innerConstraintH = self.innerConstraintH.setMultiplier(multiplier: newMultiplier1)
//                
//                self.layoutIfNeeded()
//            }) { (finish) in
//                
//            }
//        } else {
//            UIView.animate(withDuration: 0.4, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: [], animations: {
//                let newMultiplier:CGFloat = 0.786
//                self.backgroundConstraintW = self.backgroundConstraintW.setMultiplier(multiplier: newMultiplier)
//                self.backgroundConstraintH = self.backgroundConstraintH.setMultiplier(multiplier: newMultiplier)
//                
//                let newMultiplier1:CGFloat = 0.5
//                self.innerConstraintW = self.innerConstraintW.setMultiplier(multiplier: newMultiplier1)
//                self.innerConstraintH = self.innerConstraintH.setMultiplier(multiplier: newMultiplier1)
//                
//                self.layoutIfNeeded()
//            }) { (finish) in
//                
//            }
//        }
//    }
//    
//
//    ///
//    /// 选中无动画效果
//    ///
//    public func noAnimatedSelected() {
//        
//        if self.selectedStyle == .large {
//            let newMultiplier:CGFloat = 1
//            self.backgroundConstraintW = self.backgroundConstraintW.setMultiplier(multiplier: newMultiplier)
//            self.backgroundConstraintH = self.backgroundConstraintH.setMultiplier(multiplier: newMultiplier)
//            
//            let newMultiplier1:CGFloat = 0.64
//            self.innerConstraintW = self.innerConstraintW.setMultiplier(multiplier: newMultiplier1)
//            self.innerConstraintH = self.innerConstraintH.setMultiplier(multiplier: newMultiplier1)
//            self.layoutIfNeeded()
//        } else {
//            let newMultiplier:CGFloat = 0.786
//            self.backgroundConstraintW = self.backgroundConstraintW.setMultiplier(multiplier: newMultiplier)
//            self.backgroundConstraintH = self.backgroundConstraintH.setMultiplier(multiplier: newMultiplier)
//            
//            let newMultiplier1:CGFloat = 0.5
//            self.innerConstraintW = self.innerConstraintW.setMultiplier(multiplier: newMultiplier1)
//            self.innerConstraintH = self.innerConstraintH.setMultiplier(multiplier: newMultiplier1)
//            self.layoutIfNeeded()
//        }
//    }
//
//    
//    ///
//    /// 取消选中效果
//    ///
//    func unselected() {
//        
//        selectedFlag = false
//        
//        UIView.animate(withDuration: 0.2, animations: {
//            let newMultiplier:CGFloat = 0.5
//            self.backgroundConstraintW = self.backgroundConstraintW.setMultiplier(multiplier: newMultiplier)
//            self.backgroundConstraintH = self.backgroundConstraintH.setMultiplier(multiplier: newMultiplier)
//            
//            self.innerConstraintW = self.innerConstraintW.setMultiplier(multiplier: newMultiplier)
//            self.innerConstraintH = self.innerConstraintH.setMultiplier(multiplier: newMultiplier)
//            
//            self.layoutIfNeeded()
//        })
//    }
//}
//
//
//
